import React, { Component } from 'react'
import store from './redux/store'

export class App extends Component {
  render() {
    return (
      <div>
        <button onClick={()=>{
          if (store.getState().list1.length == 0){
            // dispatch
            store.dispatch({
              type: 'get-list1'
            })
          }else {
            console.log("缓存1", store.getState().list1)
          }
        }}>异步缓存1</button>
         <button onClick={()=>{
          if (store.getState().list2.length == 0){
            // dispatch
            store.dispatch({
              type: 'get-list2'
            })
          }else {
            console.log("缓存2", store.getState().list2)
          }
        }}>异步缓存2</button>
      </div>
    )
  }
}
